package com.example.chatgpt.viewModel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class MessageViewModel extends ViewModel {

    private MutableLiveData<String> questionMessage;
    private MutableLiveData<String> responseMessage;

    public MutableLiveData<String> getQuestionMessage() {
        if (questionMessage == null){
            questionMessage = new MutableLiveData<>("");
        }
        return questionMessage;
    }

    public MutableLiveData<String> getResponseMessage() {
        if (responseMessage==null){
            responseMessage = new MutableLiveData<>("");
        }
        return responseMessage;
    }

    public void onQuestionChanged(String question){
        getQuestionMessage().postValue(question);
    }

    public void onResponseChanged(String response){
        getResponseMessage().postValue(response);
    }


}
